package test02;

import java.util.Arrays;
import java.util.Random;

public class demo02 {
    public static void main(String[] args) {
        int arr[]=new int[10];
        Random random=new Random();
        for(int i=0;i<arr.length;i++){
            arr[i]=random.nextInt(100)+1;
        }
        System.out.println("数组为:"+Arrays.toString(arr));
        int min=arr[0];
        int max=arr[0];
        for(int i=1;i<arr.length;i++){
            if(min>arr[i]){
                min=arr[i];
            }
            if(max<arr[i]){
                max=arr[i];
            }
        }

        System.out.println("最小值为:"+min);
        System.out.println("最大值为:"+max);
    }
}
